package com.ehotting.edsta.csharpServer.controller;

import com.ehotting.eaf.core.utils.SecurityUtils;
import com.ehotting.eaf.core.web.domain.AjaxResult;
import com.ehotting.edsta.common.log.annotation.Log;
import com.ehotting.edsta.common.log.enums.BusinessType;
import com.ehotting.edsta.csharpServer.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Api(tags = "UserController", description = "c端用户相关接口")
public class UserController {
    @Autowired
    private ISysUserService sysUserService;
    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @Log(title = "用户信息",businessType = BusinessType.GET_DATA)
    @GetMapping("/getInfo")
    @ApiOperation("获取当前登录的用户信息")
    public AjaxResult getInfo() {
        Long userId = SecurityUtils.getUserId();
        AjaxResult ajax = AjaxResult.success();
        ajax.put("user", sysUserService.selectUserById(userId));
        return ajax;
    }
}
